home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 5
/
Aminet 5 - March 1995.iso
/
Aminet
/
util
/
cli
/
mcd1_40.lha
/
mcd.doc
< prev
next >
Wrap
Text File
|
1994-11-16
|
26KB
|
688 lines
THIS IS NOT SHAREWARE
IT IS FOR FREE !
DO NOT PAY 10$ !
16. November 1994
$VER: MCD V1.40
Written by Martin Weiss and Oliver Kaufmann
Released on November 14th, 1994
MCD comes with:
MCDScan_000 V1.40 scan utility for MC68000
MCD_000 V1.40 main program for MC68000
MCDScan_020 V1.40 scan utility for MC68020 or higher processors
MCD_020 V1.40 main program for MC68020 or higher processors
CkFPBits V1.01 check file protection bits utility
MCDenv configuration environment variable
MCD.doc (this file)
MCD.doc.info
This program is Copyright 1993, 1994 by Martin Weiss and Oliver Kaufmann.
All Rights Reserved. MCD is freely distributable, but the authors retain all
rights in regards to the program. Permission is granted to distribute this
program for a minimal charge (for copying, handling, etc.).
This package may be distributed as is only. Executables must NOT
be crunched in any way. Use these programs at your own risk, no warranties
will be made.
MCD (My Change Directory) is a Shell-command similar to CD with many
additional features. It features directory abbreviation, i.e. recognition
by initials without specification of complete AmigaDOS paths and provides
"directory shuffle". All wildcards are supported. MCD uses a brain file
containing the directory structure of your hard disks. Multiple volumes
are supported. The brain file is permanently loaded into memory only once
when MCD is called for the first time. This brain file is created by the
MCDSCAN program that also comes with this package.
MCD can be used from the command line only as it is a shell command !?
It has been thoroughly tested on Amiga 500 - 4000 under various
configurations. Requires AmigaDOS 2.0 or higher.
Using MCD
=========
I.Quick Start
-------------
a. Copy MCD_0x0 to your c: directory (or to any other directory, which is
in your path) and rename it to MCD (or maybe CD, if you like)
b. Copy MCDScan_0x0 to your c: directory (or to any other directory, which is
in your path) and rename it to MCDScan
c. Edit MCDenv to suit your desire and/or just copy it to env: and envarc:
:> copy MCDenv env:
:> copy MCDenv envarc:
d. Create the brain file by
:> mcdscan -c <volume>
where <volume> is your harddisk (e.g. dh0:, dh1: or fh0:, fh1: ...)
This will create a file s:mcd.tree
e. Go ahead and have a try!
:> mcd <pattern>
e.g. mcd print will probably cd you to <volume>:devs/printers
e.g. mcd priTN will probably cd you to <volume>:devs/printers as well!
^^
II.Program Descriptions
-----------------------
1. Creating the brain file with MCDSCAN
---------------------------------------
The syntax for MCDSCAN is
MCDSCAN [[-a|-c|-s][file]] directory [directory list] [~excludedirs]
-c[file]: create a brain file for one or more directories
default file is s:mcd.tree
-a[file]: append one or more directories to the brain file
default file is s:mcd.tree
-s[file]: use a scriptfile containing a directory list
default is s:mcd.script
directory: directories to be scanned
excludedirs: directories not to be scanned (must be preceeded by ~)
no options: dump all directories matching the specified directory
Examples:
Suppose your hard disk is device DH0: volume HARD: containing the following
files:
Prefs (dir)
Env-Archive (dir)
sys (dir)
wbconfig.prefs
Presets (dir)
Font Font.info
...
Libs (dir)
asl.library commodities.library
L (dir)
aux-handler port-handler
queue-handler speak-handler
S (dir)
Startup-sequence Startup-sequence.HD
Devs (dir)
Keymaps (dir)
Printers (dir)
Example (dir)
generic
clipboard.device MountList
system-configuration
C (dir)
AddBuffers Assign
...
ThisIsAVeryLongDirectoryName (dir)
ThisIsAnEvenLongerDirectoryName (dir)
ContainingAnotherFingerBreaker (dir)
and_file_1
and_file_2
emaNyrotceriDsihTdaeRuoYnaC (dir)
emaNyrotceriDsihTepyTuoYnaCrO (dir)
you_cannot
even_remember_it
The first thing you have to do is to scan your hard disk drive dh0: by
1> MCDScan -c dh0:
which will generate a brain file called MCD.tree in your S: directory.
This file stores all of the directory structure on your hard disk in
preprocessed form. It is essential not to modify this file.
Scanning a Quantum LPS 105MB hard disk with a GVP SCSI II controller
takes up to 2 minutes (with 600 directories) and produces a brain file of
about 10 kBytes.
You can also use subdirectories like
1> MCDScan -c dh0:prefs
or
1> MCDScan -c DEVS:
To scan several devices or directories simply type
1> MCDScan -c dh0: dh1: Tools: dh2:compiler
If you want to add one or more volumes to the brain file type
1> MCDScan -a dh4: dh5:
In this version it is not possible to remove or update a volume in an
existing brain file. This means you have to rescan ALL of your drives if
the directory structure in your brain file is out of date.
(See below for a tricky workaround.)
Anyway, you can join brain files for different volumes using the Amiga-DOS
command JOIN to give one brain file.
If you have a lot of volumes to be scanned each time it would be quite
annoying to specify all of them in the command line. For more ease
and comfort the '-s' switch has been implemented.
The only thing you have to do is to create a file called MCD.SCRIPT
containing all volume names to be scanned in plain ASCII (no blank lines)
and place it in your s: directory.
For example s:mcd.script could look like this
dh0:
dh1:
dh2:
fh0:
fh1:
fh2:
~dh0:temp
~fh0:tmp
~fh1:private
Then
1> MCDScan -s
would do the job. (= MCDScan -c <filelist from s:mcd.script>)
Remember: ~<excludedir> means that this directory and all dirs in its subtree
will not be scanned (added to the directory structure database), so you won't
be able to MCD to those.
Since Version 1.03 you can also say something like
1> MCDScan [-a[outfile]] -s[scriptfile]
1> MCDScan [-c[outfile]] -s[scriptfile]
1> MCDScan pattern [pattern list]
examples:
1> MCDScan -a -sram:temp.script
1> MCDScan -cs:mcd.tree_test -sram:temp.script
1> MCDScan -s -a
1> MCDScan -s -c ~temp
1> MCDScan tools de* ?dri*
If you don't specify the -c or -a switch in scriptmode, MCDScan assumes -c,
i.e. create a new s:mcd.tree file and use the scriptfile given. -s simply tries
to use s:mcd.script if available.
If you've got a lot of volumes which usually don't change (e.g. boot
partitions), but still some which do change (work partitions), then it
would be a good idea to store them in different treefiles.
That means, create one treefile, let's say s:mcd.tree_boot, with e.g.
1. > MCDScan -cs:mcd.tree_boot boot:
for your boot partition.
Then create another treefile, let's say s:mcd.tree_work, with e.g.
2. > MCDScan -cs:mcd.tree_work work:
for your work partition
Now join both treefiles to one by
3. >join s:mcd.tree_boot s:mcd.tree_work TO s:mcd.tree
After that you can use the new treefile as usually.
If your work partition changes then you just have to repeat steps 2 and 3.
That's it! Step 2 replaces the obsolete s:mcd.tree_work treefile and step 3
creates the new brainfile to be used.
Keep in mind that MCD by default uses s:mcd.tree as its brainfile. So when creating
treefiles with other names (e.g. -c<filename>) you will have to rename or
join them to a file called s:mcd.tree in order to take effect.
If you want MCD to use a file other than s:mcd.tree then you can specify a line
TREEFILE <path/filename> in your MCDenv environment variable.
Remember that MCDScan does not take care of MCDenv!
Workaround
----------
This is my implementation:
- I have got a directory s:mcdtrees, where I store all my scanned
directories and volumes (dh0: dh1: pclinuxnfs: Amigaserv: ...) as
separate files. e.g. mcdtree.dh0 mcdtree.dh1 mcdtree.pcl ...
- This is how I create them ^ ^ ^
mcdscan -cs:mcdtrees/mcdtree.dh0 dh0:
mcdscan -cs:mcdtrees/mcdtree.dh1 dh1: (*)
mcdscan -cs:mcdtrees/mcdtree.pcl pclinuxnfs: ...
- I've included these 5 lines into my user-startup
ckfpbits >nil: s:mcdtrees/mcdtree.#? a
if NOT warn
join >nil: s:mcdtrees/mcdtree.#? TO s:mcd.tree
protect s:mcdtrees/mcdtree.#? a add
endif
- If I want to rescan a special volume (or add a new one), I've got to
issue one of the commands from (*) e.g.
mcdscan -cs:mcdtrees/mcdtree.dh0 dh0: (or something similar)
With my next reboot all files in s:mcdtrees will be joined to s:mcd.tree
and their protection flags will be set to a (archive). (With further
reboots no more files will be joined until at least one is modified or a
new one is added to the s:mcdtrees directory.
Without options to mcdscan you can see a list of all directories matching a
certain pattern in alphabetic order. All wildcards are supported as
explained below. MCDScan #? lists all directories in the brain file.
Limitations of MCDScan -s:
- The number of directories (devices, volumes etc.) in a scriptfile
must not exceed 253 (probably no limitation, who's got 253 volumes?).
The number of excludedirs in a scriptfile must not exceed 253.
Nevertheless the mcd.tree file is NOT limited in any respect.
So you can join multiple treefiles to one containing as many directory
structures as you like.
2. Using MCD
------------
usage: mcd <pattern>
Now you can use MCD almost as a substitute for the CD command:
1> MCD dh0:c
will work exactly as
1> CD dh0:c
Note:
MCD first of all tries to change directory directly to the specified
pattern. On success there will not be any additional scaning of the
database and MCD will return. This is to provide the highest compatibility
with the original CD command. If this first attempt is not successful MCD
will unfold its true power and use the supplied database to find a matching
directory to change to. If you've got more volumes scanned MCD will at first
try to find a match on the current volume, then on the others. This is not
true if you are in shuffling mode (see below).
But you can now do a lot of things more: you can use abbreviations and
wildcards on any directory. MCD will look up a matching directory and
change the current directory to this directory. Just look at the following
examples:
MCD CD
------ ------
1> MCD sys CD hard:prefs/env-archive/sys
2> MCD print CD hard:devs/printers
3> MCD This/This CD hard:ThisIsAVeryLongDirectoryName/
ThisIsAnEvenLongerDirectoryName
4> MCD #?archive CD hard:prefs/env-archive
5> MCD //k CD hard:devs/keymaps
This means: MCD looks up a directory having at least two
parents. Note that the root directory is treated like an
ordinary directory even if it is separated by a colon.
6> MCD :/k CD hard:devs/keymaps
This takes you to a directory exactly one level below
the root directory.
7> MCD devs:ke CD hard:devs/keymaps
You can also use logical volumes assigned to directories on
hard disks in your brain file. All logical volumes are
resolved to their full physical path: DEVS: is expanded to
HARD:devs (or wherever you have it assigned to).
WARNING: You should NOT use logical directories when scanning your hard
disks. These names are expanded to their physical names but still treated
as one unit. For example:
1> MCDScan devs:
2> MCD :/e CD hard:devs/printers/example
But nevertheless: this enables you to use names assigned after scanning
in your patterns (as these are expanded to physical names anyway).
Remeber: no wildcards like #? (or *, if you are using WildStar) are
required at the end of a pattern, that doesn´t already contain wildcards.
If the given pattern does already contain userspecified wildcards,
#? will NOT automatically be added to the end of the pattern.
That is to prevent misinterpretation of what the pattern really means.
For example mcd ? should look up all directory names consisting of only
ONE single character, as it was supposed to. It would be fatal to add #?
at the end, as it would result in mcd ?#?, which is almost the same as
mcd #? what really wasn't meant!
Note:
You may even use wildcards on volume names. That means that you can
issue somthing like
1>MCD h*:/*s/??amp*
to change to hard:devs/printers/example.
In this case MCD wil NOT try to cd directly to the specified pattern, as
this would result in a system request: please insert volume h*: in any drive.
MCD will instead look up a match immediately.
Resolving multiple matches
Usually there are several directories on your hard disk with the same or
almost the same name. MCD provides "directory shuffle":
In the above example
1> MCD ThisIs
is ambiguous. In this case MCD chooses the lexicographically smaller match
resulting in
1> CD dh0:ThisIsAVeryLongDirectoryName/ThisIsAnEvenLongerDirectoryName
From the shell prompt you can see which directory was chosen. If you
actually wanted to CD to a different directory you can simply repeat the
last command:
1> MCD ThisIs
This now results in the next match
1> CD dh0:ThisIsAVeryLongDirectoryName
You can shuffle through all matching directories until you are back at the
first match. Try
1> MCD #?
This steps through all of your directories in alphabetic order!
Note: Since V 1.40 you can independently shuffle in different shells
with different patterns.
There are special options, which can be enabled by keywords in the env
variable mcdenv. For details see the section about Environment Variables.
Here are some examples of special commands:
mcd devs: = change to devs:
mcd = tell current directory and let it become the home dir
mcd ram: = change to ram:
mcd ! = change back to last dir (devs:)
mcd ! = change back to last dir (ram:)
mcd ~ = change to home dir (devs:)
mcd ! = change back to last dir (ram:)
mcd ~/dosd = change to homedir/dosdrivers
mcd !/t = change to lastdir/t
...
To find out about MCD just play around with it and see what happens.
Environment Variables
---------------------
MCD uses an environment variable for its configuration. It is called MCDenv
and consists of plain ASCII. Each line may hold only one keyword at the
very beginning of each line as described below:
warnings : to turn on the printing of warnings (verbose mode)
quickcd : to do 'quick' cds instead of 'slow' ones
staylocal : force MCD not to cd to volumes other than the current one
dynamic : MCD will try to read :mcdtree from the current volume and use
it as its brainfile.
treefile <path/file> : have MCD use <path/file> instead of any default.
dotdot : turn on handling of .. ../ and ./
lastdir : enable storing of most recently used dir, mcd ! jumps back
homedir : enable home dir feature, mcd stores current dir as home
mcd ~ takes you back there, also mcd ~/path works.
If MCDenv contains the string 'warnings', then mcd will print warnings
about non existing directories, reminding to rescan disks (verbose mode).
If it contains the string 'quickcd', mcd will not behave exactly like
AmigaDos CD. This only affects patterns containing wildcards. In detail it
will ONLY ONCE try to cd direktly (locally) to a specified pattern. If a
pattern contains wildcards, mcd (since V1_06) at first would usually do a
series of MatchNext()s like AmigaDos to find a matching directory locally.
As a matter of fact this would take some time (listen to your hard disk).
Furthermore you probably never wanted to cd locally, but just did so right
now. To prevent such waste of time and unwanted local cds, you can specify
the keyword 'quickcd'. Then mcd will only once (concession) try to cd locally.
If it does not find a matching directory in the first attempt, it will
immediately look up a matching directory in its database, as supposed.
Time evaluation:
Try this: cd c:* .....wait.....wait....ok, I understand!
Try this: mcd c:* without 'quickcd' set ....wait....wait....ok I see!
Try this: mcd c:* with 'quickcd' set ...ah!
Nevertheless most mcd <pattern>#? will probably work with or without
'quickcd' set. Depends, if and what files/dirs match the pattern locally.
(Especially mcd ram:req* will hopefully work!)
If MCDenv contains the string 'staylocal', then mcd will not cd to volumes
other than the current one, even if there are numerous others stored in the
brainfile. This might be usefull, if you've got many volumes scaned and you
don't want to jump through all of them only to find one directory on the
volume you are currently on.
If MCDenv contains the string 'dynamic', then every time you invoke mcd,
it will inquire if there is a file called :mcdtree on the current volume.
If it is and it hasn't bee loaded before, the file will be read in as the new
brainfile. That means every volume can have its own brainfile. The brainfile
will be kept in memory until you cd to a different volume and issue mcd there,
which will discard the old one and read in the new one. Remember that for mcd
the default dynamic brainfile is :mcdtree. Without dynamic (normal) the
default brainfile is s:mcd.tree !
If MCDenv contains the string 'treefile <path/file>', mcd will use that as
its new default brainfile (both for dynamic and normal mode !)
To set the env-variable, type
:> setenv mcdenv warnings
or
:> setenv mcdenv quickcd
If MCDenv contains the string 'dotdot', mcd will try to handle .. ../ and
./ like DOS/UNIX does. Mcd ../path should work as well.
If MCDenv contains the string 'lastdir', mcd stores the most recently used
current directory in the environment variable mcdlast. Mcd ! will take you
back there. Type mcd ! again to toggle between two directories.
If MCDenv contains the string 'homedir', mcd issued with no arguments will
store the current directory as the home directory in the environment variable
mcdhome. Mcd ~ takes you back to your home directory. Mcd ~/path should work
as well.
If you want to add more than one keyword to the env-variable,
you have got to use your favourite text editor (e.g. ed, emacs, vi,
edward or ced). Put each keyword in its own line, save the file to
env:mcdenv. I've included my mcdenv file for your convenience. Just edit it
and copy it to envarc:. You can comment out any keyword by putting a '#'
infront of it (actually any character).
To permanently use your configuration copy env:mcdenv to envarc:
:> copy env:mcdenv to envarc:
The MCDenv environment variable does not affect MCDScan at all!
3. Updating the brain file
--------------------------
Actually there is no way for updating the brain file (yet), so whenever new
directories are created those are not automatically appended to the brain
file. Therefore you should re-scan your hard disk (as described above) in
regular intervals to keep the brain file up to date.
Changes to the brain file will take effect immediately after scanning.
4. Not yet implemented
----------------------
- intuition interface for MCDScan
- automatic updating for the brain file
- pure MCD to be held resident
- assembler version for more speed
- merge both MCD and MCDScan into one programm MCD
5. Inspiration
--------------
This program was inspired by NCD from Norton Utilities on MS-DOS and Uffe
Holst Christiansen, whose UCD on fish disk 785 did not quite meet our
expectations.
MCD is superior in many ways:
- it's faster both scanning the disk and changing directories
- the brain file is shorter (less than 50 %)
- the brain file is loaded only once for very fast access
- properly sets the path prompt (UCD does not)
- fully supports wildcards (UCD does not, neither does NCD)
- directory shuffle (UCD does not)
6. CkFPBits Description
-----------------------
usage: CkFPBits filepattern [ProtectionBits (sparwed)] [-p]
CkFPBits takes a file or filepattern and a set of protection bits as its
arguments. It returns a returncode of 0 (OK) or 5 (WARN) depending on the
given ProtectionBits and the corresponding Bits of the matching file(s).
In detail CkFPBits returns 5 (WARN), if ALL matched files DO HAVE the given
ProtectionBits SET. Otherwise it returns 0 (OK), i.e. if at least one of
the given ProtectionBits of at least one matched file is NOT SET.
If the -p switch is given, detailed file information is printed.
7. Miscellaneous
----------------
MCD was written using the MANX Aztec C Compiler V5.2 on an Amiga 4000 and an
Amiga 2000 with GVP G-Force040/33.
If you have also problems with Aztec C on 68040 machines: force the compiler
NOT to automatically start the assembler using the -a option and launch the
assembler separately.
The brain file is kept in memory as a resource called mcd.resource.
We do not see a moral obligation to pay a shareware fee for this kind
of program. Keep your money - get a grip on yourself and write some
useful little programs for the Amiga community.
If you have any questions or comments regarding this program, please feel
free to get in touch with us at the following addresses:
Oliver Kaufmann
Eserwallstrasse 8
86159 Augsburg
Germany e-mail: kaufmano@informatik.tu-muenchen.de
Martin Weiss
Eichendorffstrasse 4
86368 Gersthofen
Germany e-mail: weissmar@rzsun2.rz.uni-augsburg.de
DISCLAIMER: Use this program at your own risk.
Feedback, Suggestions and Proposals:
------------------------------------
These are the people, who had the guts to contribute their ideas to mcd
- Tero Turtiainen: directory exclusion (in)
(Mon, 20 Sep 1993 11:38:32)
- Peter Bernhard quiet/verbose mode (in)
- Richard Hartmann slow/quick cd (in)
THANKS to
- Jay Miner for the Amiga
- Ralph Babel for his Guru-Book
- Lyman Epp for QMouse
- Kai Iske for KCommodity
- Thomas Krehbiel for vt
- MANX for the C compiler (even if it does not work properly on 68040)
- Nic Wilson for his 25th anniversary of SysInfo
- Peter Norton for the idea and Uffe Holst Christiansen for his first
attempt
- Olaf Barthel and all the others for their freeware concept
- all those GNU contributors and linux makers
- all the others I haven't mentioned yet
NO THANKS to
- Commodore for secretiveness, arrogance and nonexisting support
quote in German: "...Der A4000 ist die Wucht in Tüten...", which is
definitely not true! R.I.P.
- Data Becker for hundreds of errors in their books
Amiga Intern: ... P725, P750, P769, P785, P1018, P1019 ...
- all those who disable their software with annoying requesters and
call it shareware, accept this program as payment
KNOWN BUGS:
- :/// does not work correctly
LEGEND:
- brainfile = treefile : file that stores the directory structure
created with mcdscan (default s:mcd.tree)
- mcdenv : environment variable used to configure mcd
- mcd : main program, changes directory
- mcdscan : needed to create the necessary brainfile
- [<option>] : Option which can be given (e.g. in mcdenv)
WHATSNEW in V 1.20:
- local treefiles for each volume (like ncd on MS-DOS) [DYNAMIC]
- mcd can be forced to stay local on the current volume, i.e. not change
directory to different volumes. [STAYLOCAL]
- the name of the brainfile to use can be configured in mcdenv [TREEFILE]
WHATSNEW in V 1.30:
- handle .. ../ and ./ (DOS/UNIX syntax) [dotdot]
- mcd can store the current dir as a home dir [homedir] by just typing mcd,
mcd ~ immediately takes you back there
- mcd stores the most recently used dir [lastdir]
mcd ! takes you back there (and forth)
WHATSNEW in V 1.40:
- mcd now acts local to each shell
- mcd !/path now works as well
HISTORY:
V1_40: fixed dirshuffle to be local, now works in different shells
minor changes in mcdscan
V1_35: fixed GVF_GLOBAL_ONLY to GVF_LOCAL_ONLY for homedir and lastdir
now works in different shells
V1_30: added homedir (~), lastdir (!) and .. ../ and ./ handling
MCDScan unchanged
V1_20: added staylocal, dynamic and treefile configuration
V1_06: added slow/quick cd and corresponding env-variable settings
included example mcdenv environment variable
V1_05: Some minor bug fixes
V1_04: Included ckfpbits program, added path exclusion, environment variable
V1_03: MCDScan Interface changed to allow combined options with filenames
MCD unchanged
V1_02: ...
V1_01: ...
V1_00: ...